package lucid.hrms.management.race;

import java.util.List;
import java.util.Map;

import org.primefaces.model.LazyDataModel;

public class RaceLazyDataModel extends LazyDataModel<Race> {
	private static final long serialVersionUID = 1L;

	private RaceCriteria raceCriteria;
	private RaceService raceService;

	public RaceLazyDataModel(RaceCriteria raceCriteria, RaceService raceService) {
		this.raceCriteria = raceCriteria;
		this.raceService = raceService;
	}

	@Override
	public List<Race> load(int first, int pageSize, String sortField,
			boolean sortOrder, Map<String, String> filters) {
		// TODO Auto-generated method stub
		return raceService.findRaces(raceCriteria, first, pageSize);
	}

	@Override
	public int getRowCount() {
		// TODO Auto-generated method stub
		return raceService.findTotalRaces();
	}
}
